<template>
  <div>
    <button @click="isShow = !isShow">显示/隐藏</button>
    <transition name="hello" appear>
        <h1 v-show="isShow" >你好啊</h1>
    </transition>
  </div>
</template>

<script>
export default {
    name:'TestCom2',
    data(){
        return{
            isShow:true
        }
    }

}
</script>

<style scoped>
    h1{
        background-color: orange;
    }
    /* 起名字就这么写，不起名字就用v- */
    .hello-enter-active{
        animation: atguigu 1s;
    }
    .hello-leave-active{
        animation: atguigu 1s reverse;
    }
    @keyframes atguigu {
        from{
            transform: translateX(-100px);
        }
        to{
            transform: translateX(0px);
        }
    }
</style>